<link href="__PUBLIC__/css/page.css" rel="stylesheet"  type="text/css" />
<style type="text/css">
.peicai-btn {
	background-color: #2bb6e8;
	border-color: #2bb6e8;
}
.peicai-btn:hover {
	background-color: #2bb6f9;
	border-color: #2bb6f9;
}
.btn-cancel-order {
	margin-top: 2px;
}
</style>
<div class="pd-20">
	订单类型：
        	<select onchange="change(this);" id="state-sel">
	        	<option value="0">当期订单</option>	
	        	<option value="1">历史订单</option>
	        	<!--option value="2">已配送</option>
	        	<option value="3">已送达</option-->
        	</select>&nbsp;&nbsp;<a class="btn btn-success" href="{:U('Admin/Order/curOrderDeliverList')}">导出当期配送单</a>
        	<a class="btn btn-success" href="{:U('Admin/Order/curFoodCountList')}">导出当期菜品统计</a>
    <if condition="$res eq null ">
        <div class="row">没有订单</div>
        <else />
        <div class="mt-20">
        	
            <table class="table table-border table-bordered table-bg table-sort table-striped">
                <thead>
                    <tr class="text-c">
                        <th width="30">订单号</th>
                        <th width="20">期数</th>
                        <th width="30">菜篮号</th>
                        <th width="100">创建时间</th>
                        <th width="50">订单状态</th>
                        <th width="30">订单类型</th>
                        <th width="150">操作</th>
                        <!--th width="50">操作</th-->
                    </tr>
                </thead>
                <!--{$vo.postcode}-->
                <tbody>
                    <volist name="res" id="vo" key="k">
                        <tr class="text-c">
                            <td>{$vo.oid}</td>
                            <td>{$pname}</td>
                            <td>{$vo.basketid}</td>
                            <td>{$vo.addtime|date="y-m-d H:i:s",###}</td>
                            <td><if condition="$vo.state eq 1">未配送<elseif condition="$vo.state eq 2"/>已配送<elseif condition="$vo.state eq 3"/>已送达</if></td>
                            <td><if condition="$vo.autoorder eq 0">手动<elseif condition="$vo.autoorder eq 1"/>自动<elseif condition="$vo.autoorder eq 2"/>取消</if></td>
                            <td><a class="btn btn-success" onclick="manage_edit('详情','{:U("Admin/Order/detailOrder", array("oid" =>$vo["oid"]))}','4','','{$vo.ofoods|count=###}','{$vo.postcode}')">详情</a>							
							<if condition="$vo.autoorder eq 1 OR $vo.autoorder eq 2"><a class="btn btn-success btn-cancel-order" href="{:U('Admin/Order/cancelManuOrder', array('oid' => $vo['oid']))}">取消订单</a></if>
                            </td>
                        </tr>
                    </volist>
                </tbody>
            </table>
        </div>
    </if>
    <div class="row cl dataTables_wrapper" id="upage">
        {$page}
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
<script>
//用户-编辑
function manage_edit(title, url, id, w, h, pc) {
	var height = 400 + (h-1)*31;
	if(pc == null) {
		height -= 31;
	}
    layer_show(title, url, w, height);
}

function manage_edit_order(title, url, id, w, h) {
	layer_show(title, url, w, h);
}

function change(obj) {
	//window.location.href="/index.php/Admin/Order/showAll/state/"+$(obj).val();
	window.location.href = "{:U('Admin/Order/showAll', array(),false)}"+'/state/'+$(obj).val();
}

$(document).ready(function(){
	var state = {$state};
	$("option").each(function(){
		var opt_val = $(this).val(); 
		if(opt_val == state) {
			$(this).attr("selected",'');
		}
	});
});
</script>
